<div class="main_right_between">
    <div id="results">
        <p id="keyword"><?=$keyword?></p>
        <?php if(!empty($results)):?>
            <p id="num_rs">( <?=count($results)?> kết quả )</p>
        <?php else:?>
            <p id="num_rs">( 0 kết quả )</p>
        <?php endif;?>
    </div>
    <?php if(!empty($results)):?>
        <?php
                $count = 1;
                $total = count($results);
                $page = 1;
        ?>
        <?php foreach($results as $result):?>

            <?php
                if($count == 17):
                    $count = 1;
                    $page++;
                endif;
            ?>


            <?php if($count == 1):?>
                <?php if($page == 1):?>
                    <div id="pr1" class="page _current" style="">
                    <div class="product">
                <?php else:?>
                    <div id="pr<?=$page?>" class="page" style="display:none">
                    <div class="product">
                <?php endif;?>
            <?php endif;?>

    		<div class="product_new">
                <form action="" class="addcart" method="POST">
            	<div class="text_PRODUCT1">
            	   <p class="pro_name"><a style="color: #2CF7F7!important;" href="#"><?= $this->_helper->limited_word(ucfirst($result['product_name']),3)?></a></p>
            	</div>
            	<div class="img_product">
                    <p class="img_bg">
	                    <?php if(is_file("admin/".$result['product_thumb'])):?>
	                	   <a href="<?= _BASE_URL?>index.php?module=product&action=detail&slug=<?=$result['slug']?>"><img src="admin/<?=$result['product_thumb']?>" /></a>
	                    <?php else:?>
	                        <a href="<?= _BASE_URL?>index.php?module=product&action=detail&slug=<?=$result['slug']?>"><img src="admin/assets/uploads/images/news/imgerr.jpg" /></a>
	                    <?php endif;?>
                    </p>
           		</div>
                <div style="clear: both;"></div>
            	<div class="text_PRODUCT_price">
            	 	<?php if($result['product_price_sale'] != 0):?>
                        <?= number_format($result['product_price_sale'],0,",",".")?> VNÐ
                    <?php else:?>
                        <?= number_format($result['product_price'],0,",",".")?> VNÐ
                    <?php endif;?>
                </div>
                <a class="product_icon1 cart" href="#giohang">
                	<img src="<?= _BASE_URL?>assets/frontend/css/img/icon_muahng.png">
                </a>
                <a class="product_icon1" href="<?= _BASE_URL?>index.php?module=product&action=detail&slug=<?=$result['slug']?>">
                	<img src="<?= _BASE_URL?>assets/frontend/css/img/icon_chitiet.png">
                </a>
                <input type="hidden" value="<?=$result['product_id']?>" name="product_id" />
            </form>
            </div><!--End of .product_new -->


            <?php if($count == $total || $count == 16 || ($count + ($page-1)*16) == $total) :?>
                </div><!--End of .product -->
                </div>
            <?php endif;?>

            <?php $count++?>
        <?php endforeach;?>
    <?php else:?>
    <div id="noresult">
        <p class="viewcart_title" style="text-align: center!important;">Không tìm thấy kết quả nào.</p>
        <p class="error_msg" style="font-size: 1.5em!important;color:#18E2E2!important">Ấn <a href="<?= _BASE_URL?>"><img src="assets/frontend/css/img/back.png" /></a> để quay trở lại.</p>
        <p class="error_msg" style="font-size: 1.5em!important;color:#18E2E2!important">Hoặc</p>
        <p class="viewcart_title" id="cart_msg" style="text-align: center!important;color:#18E2E2!important"></p>
    </div>
    <?php endif;?>


    <div style="clear: both;"></div>

    <div class="paging">
        <div class="productpaging" style="width: 315px; margin-left: 186px"></div>
    </div><!--End of #paging -->
    <div class="back"><a title="Quay lại trang chủ" href="<?= _BASE_URL?>">Back</a></div>
</div><!--End of .main_right_between -->

<script>

	// Created by: Jon Brown :: http://allthingsrunescape.freewebs.com
	var c=5;
	var t;
	var domain = 'http://localhost/my_framework/';

	var check = jQuery("#noresult").length;


	function timedCount()
	{
		document.title='Winesey redirecting ' + c + 's';

		c=c-1;
		if(c>0)
		{
		    var msg = 'Hệ thống sẽ tự động chuyển về trang chủ trong ' + c + 's' ;
			jQuery("#cart_msg").html(msg);
		}

		  t=setTimeout("timedCount()",1000);
		  if (c==-1)
		{
		clearTimeout(t);
		document.title='Redirecting ...';
		//jQuery("#abc").html(c);
		self.location=domain;
	  }
	}

	if(check > 0)
	{
	    window.onload=timedCount;
	}
</script>

<script type="text/javascript">

   jQuery.noConflict();

   jQuery(".productpaging").paginate({
				count 		: 5,
				start 		: 1,
				display     : 5,
				border					: false,
				text_color  			: '#888',
				background_color    	: '#EEE',
				text_hover_color  		: 'black',
				background_hover_color	: '#CFCFCF',
                mouse                   : 'press',
                onChange     			: function(page){
											jQuery('._current').removeClass('_current').hide();
											jQuery('#pr'+page).addClass('_current').show();
										  }
	});

</script>